<template>
  <div>
    <p class="title">用户列表</p>
    <div>
      <div class="he">
        <div class="box1">
          <div>
            <span>是否认证：</span>
            <el-select v-model="value1" placeholder="全部" size="small">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>

          <div>
            <span>是否会员：</span>
            <el-select v-model="value2" placeholder="全部" size="small">
              <el-option
                v-for="item in options2"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
          <div>
            <span>用户类型：</span>
            <el-select v-model="value3" placeholder="全部" size="small">
              <el-option
                v-for="item in options3"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>
        <div class="box2 el-icon-search">
          <input v-model="input" placeholder="搜索昵称手机号" />
        </div>
        <div class="box3">
          <div class="lstse">
            <span>管理员：</span>
            <el-select v-model="value4" placeholder="全部" size="small">
              <el-option
                v-for="item in options4"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
          <div class="lstse mleft">
            <span>状态：</span>
            <el-select v-model="value5" placeholder="全部" size="small">
              <el-option
                v-for="item in options5"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>
      </div>
      <div class="btn">
        <el-button type="primary" @click="tj">推荐</el-button>
        <el-button type="primary" @click="add">新建用户</el-button>
      </div>
    </div>

    <!-- 表格 -->
      <el-table
    ref="multipleTable"
    :data="tableData"
    tooltip-effect="dark"
    style="width: 100%"
    border
    @selection-change="handleSelectionChange">
    <el-table-column
      type="selection"
      width="55">
    </el-table-column>
      <el-table-column
      label="序号"
      type="index"
      width="50">
    </el-table-column>
    <el-table-column
      label="用户昵称"
      width="120">
      <template slot-scope="scope">{{ scope.row.username }}</template>
    </el-table-column>
    <el-table-column
      prop="gropname"
      label="管理员"
      width="120">
    </el-table-column>
    <el-table-column
      prop="phone"
      label="手机号"
      show-overflow-tooltip>
    </el-table-column>
    <el-table-column
      prop="auth"
      label="是否认证"
      show-overflow-tooltip>
    </el-table-column>
    <el-table-column
      prop="lastlogin"
      label="最近登录"
      show-overflow-tooltip>
    </el-table-column>
    <el-table-column
      prop="state"
      label="状态"
      show-overflow-tooltip>
    </el-table-column>
    <el-table-column
        width="240px"
      label="操作"
      >
      
       <el-link type="primary">取消推荐</el-link>
       <el-link type="primary">查看</el-link>
       <el-link type="primary">发布</el-link>
       <el-link type="primary" @click="bianji">编辑</el-link>
       <el-link type="primary">冻结</el-link>

    </el-table-column>
  </el-table>
  <!-- 分页 -->
 <Page :total="total" :PageNumber.sync="PageNumber" :PageSize.sync="PageSize" @current-change="changeCurrentPage"
        @size-change="handleSizeChange">
      </Page>
  </div>
</template>

<script>
import Page from '../../components/page.vue'
export default {
     components: {
      Page
    },
  data() {
    return {
        // 分页
          PageNumber: 1,
        PageSize: 20,
        total: 50,
         options: [
        {
          value: "选项1",
          label: "黄金糕",
        },
      ],
      value1: "",
      // 是否会员
      options2: [
        {
          value: "选项1",
          label: "黄金糕",
        },
      ],
      value2: "",
      //   用户类型
      options3: [
        {
          value: "选项1",
          label: "黄金糕",
        },
      ],
      value3: "",
      //   搜索
      input: "",
      //   状态
      options4: [
        {
          value: "选项1",
          label: "黄金糕",
        },
      ],
      value4: "",
 options5: [
        {
          value: "选项1",
          label: "黄金糕",
        },
      ],
      value5: "",

      //表格
       tableData: [{
          username: '2016-05-03',
          gropname: '王小虎',
          phone: '上海市普陀区金沙江路 1518 弄',
          auth:'2222',
          lastlogin:'1111',
          state:'xxx'
        }, {
          username: '2016-05-02',
          gropname: '王小虎',
          phone: '上海市普陀区金沙江路 1518 弄',
          auth:'2222',
          lastlogin:'1111',
          state:'xxx'
        }, {
          username: '2016-05-04',
          gropname: '王小虎',
          phone: '上海市普陀区金沙江路 1518 弄',
          auth:'2222',
           lastlogin:'1111',
           state:'xxx'
        }, {
          username: '2016-05-01',
          gropname: '王小虎',
          phone: '上海市普陀区金沙江路 1518 弄',
          auth:'2222',
           lastlogin:'1111',
           state:'xxx'
        }, {
          username: '2016-05-08',
          gropname: '王小虎',
          phone: '上海市普陀区金沙江路 1518 弄',
          auth:'2222',
           lastlogin:'1111',
           state:'xxx'
        }, {
          username: '2016-05-06',
          gropname: '王小虎',
          phone: '上海市普陀区金沙江路 1518 弄',
          auth:'2222',
           lastlogin:'1111',
           state:'xxx'
        }, {
          username: '2016-05-07',
          gropname: '王小虎',
          phone: '上海市普陀区金沙江路 1518 弄',
          auth:'2222',
          lastlogin:'1111',
          state:'xxx'
        }],
        multipleSelection: []
    };
  },
  methods: {
      //新建编辑动态组件
      tj(){
        this.$router.push("/Home/AddUser")
      },
    add(){
       this.$router.push("/Home/AddUser")
    },
    bianji(){
       this.$router.push("/Home/AddUser")
    },

      toggleSelection(rows) {
        if (rows) {
          rows.forEach(row => {
            this.$refs.multipleTable.toggleRowSelection(row);
          });
        } else {
          this.$refs.multipleTable.clearSelection();
        }
      },
      handleSelectionChange(val) {
        this.multipleSelection = val;
      },
       //改变当前页数
      changeCurrentPage(val) {
       console.log(val);
      },
      //改变每页显示条数
      handleSizeChange(val) {
       console.log(val);
      },
  },
};
</script>

<style lang="scss" scoped>
.title {
  margin-top: -10px;
  font-size: 14px;
}
.main {
  padding: 20px;
}
.el-input--small .el-input__inner {
  height: 32px;
  line-height: 32px;
  width: 126px;
}
.he {
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  .box1 {
    width: 800px;
    display: flex;
    justify-content: space-between;

    > div {
      display: flex;
      span {
        width: 100px;
        line-height: 30px;
      }
    }
  }

  .el-select {
    margin-right: 40px;
  }
}
.box2 {
  width: 240px;
  height: 32px;
  line-height: 32px;

  background: #ccc;
  display: flex;
  border-radius: 8px;
  input {
    width: 240px;
    height: 30px;
    border-style: none;
    outline: none;
    margin-left: 10px;
    background: #ccc;
    border-radius: 8px;
  }
}
.el-button--primary {
  //   margin-top: 24px;
  width: 88px;
  height: 30px;
  line-height: 5px;
  float: right;
  margin-bottom: 20px;
}
.lstse {
  width: 300px;
  display: flex;
  margin-top: 20px;
  .el-select {
    width: 152px;
  }
  span {
    width: 75px;
  }
}
.box3 {
  width: 300px;
  display: flex;
  justify-content: space-between;
}
.btn{
.el-button{
    margin-left: 20px;
}
}
.el-link{
    margin-right:10px ;
}
</style>